﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace storeSMS
{
    public partial class frmLogin : Form
    {
        public frmLogin()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {

            //登录功能已测试完成
            string name = txtName.Text;
            string pwd = txtPwd.Text.Trim();
            string sql = "";            
            sql = string.Format("select id from userinfo where uname='{0}' and upwd='{1}'", name, pwd);
            DataSet ds = DbHelperOleDb.Query(sql);
            if (ds.Tables[0].Rows.Count == 1)
            {
                frmMain f = new frmMain();
                this.Hide();
                myinfo.f = f;
                f.Show();
            }
            else
            {
                MessageBox.Show("用户名或密码错误！");
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
